home *** CD-ROM | disk | FTP | other *** search
- /**
- GRAB Graph Layout and Browser System
-
- Copyright (c) 1987, 1988, 1989 Stanford University
- Copyright (c) 1989, Tera Computer Company
- **/
-
- /**
- Exactly like the panners in the InterViews source, except
- they use myadjusters instead of adjusters
- **/
-
- #include "myadjuster.h"
- #include "mypanner.h"
- #include <InterViews/adjuster.h>
- #include <InterViews/border.h>
- #include <InterViews/box.h>
- #include <InterViews/glue.h>
- #include <InterViews/painter.h>
- #include <InterViews/panner.h>
- #include <InterViews/pattern.h>
- #include <InterViews/perspective.h>
- #include <InterViews/rubrect.h>
- #include <InterViews/sensor.h>
- #include <InterViews/shape.h>
- #include <math.h>
-
- MyPanner::MyPanner (Interactor* i, int size)
- {
- Init(i, size);
- }
-
- MyPanner::MyPanner (const char* name, Interactor* i, int size)
- {
- SetInstance(name);
- Init(i, size);
- }
-
- MyPanner::MyPanner (Interactor* i, int size, Painter* p)
- {
- output = p;
- output->Reference();
- Init(i, size);
- }
-
- /* 0.3 second delay for auto-repeat */
- static int DELAY = 3;
-
- void MyPanner::Init (Interactor* i, int n)
- {
- SetClassName("MyPanner");
- size = n;
- enlarger = new MyEnlarger(i);
- reducer = new MyReducer(i);
- adjusters = new HBox(new HGlue,
- new VBox(new UpMover(i, DELAY),
- new HBox(new LeftMover(i, DELAY), new HGlue,
- new RightMover(i, DELAY)),
- new DownMover(i, DELAY)),
- new HGlue,
- new VBox(new VGlue(2), enlarger,
- new VGlue(4), reducer, new VGlue(2)),
- new HGlue);
- slider = new Slider(i);
- Insert(new VBox(adjusters, new HBorder, slider));
- }
-
- void MyPanner::Reconfig ()
- {
- MonoScene::Reconfig();
- Shape a = *adjusters->GetShape();
-
- if (a.vstretch != 0 || a.vshrink != a.height / 3)
- {
- if (size != 0)
- {
- a.width = size;
- a.hshrink = a.hstretch = 0;
- }
-
- a.vstretch = 0;
- a.vshrink = a.height/3;
- adjusters->Reshape(a);
- }
-
- Shape* s = slider->GetShape();
-
- if (s->width != a.width)
- {
- slider->Reshape(a);
- }
- }
-
- void MyPanner::ChangeZGrad (float zg)
- {
- enlarger->ChangeZGrad( 1.0 / zg);
- reducer->ChangeZGrad(zg);
- }
-